Class ArgumentsBundle

java.lang.Object
edu.claflin.finder.algo.ArgumentsBundle

public class ArgumentsBundle extends Object
Used to supply arguments to Algorithms in a generalized manner. The caller is required to put arguments on the bundle prior to passing it to the Algorithm's constructor. The algorithm, then, can interpret the arguments it wants to and ignore others. This generalizes the constructor of the abstract Algorithm object so that algorithms that take different arguments may be created without complicating the constructors of others. Specifically, the bundle supports the following kinds of arguments: - Enums - Integers - Floats - Objects - a special Condition object list
Version:
3.0 February 2, 2016
Author:
Charles Allen Schultz II
  • Field Details

    • conditionsList

      private final ArrayList<Condition> conditionsList
      The List of conditions to apply to the Algorithm.
    • integerList

      private final HashMap<String,Integer> integerList
      The Mapping of String keywords to Notable Integer values.
    • doubleList

      private final HashMap<String,Double> doubleList
      The Mapping of String keywords to Notable Double values.
    • booleanList

      private final HashMap<String,Boolean> booleanList
      The Mapping of String keywords to Notable Boolean values.
    • enumList

      private final HashMap<String,Enum<?>> enumList
      The Mapping of String keywords to Notable Enum values.
    • objectsList

      private final HashMap<String,Object> objectsList
      The Mapping of String keywords to Notable objects.
  • Constructor Details

    • ArgumentsBundle

      public ArgumentsBundle()
      Constructs the ArgumentsBundle.
  • Method Details

    • addCondition

      public void addCondition(Condition condition)
      Adds a Condition to the conditionsList.
      Parameters:
      condition - the Condition object to add.
    • removeCondition

      public void removeCondition(Condition condition)
      Removes a Condition from the conditionsList.
      Parameters:
      condition - the Condition object to remove.
    • getConditionsList

      public List<Condition> getConditionsList()
      Gets a copy of the conditionsList that will not structurally modify the one owned by the bundle.
      Returns:
      a List of Conditions held in this ArgumentsBundle.
    • putInteger

      public void putInteger(String key, Integer val)
      Puts an integer in the integerList.
      Parameters:
      key - the String keyword which maps to the integer.
      val - the Integer to put.
    • removeInteger

      public void removeInteger(String key)
      Removes an integer from the integerList.
      Parameters:
      key - the String keyword which maps to the integer.
    • getInteger

      public Integer getInteger(String key)
      Gets an integer from the integerList.
      Parameters:
      key - the String keyword which maps to the integer.
      Returns:
      the Integer in the list or null if not present.
    • putDouble

      public void putDouble(String key, Double val)
      Puts a double in the doubleList.
      Parameters:
      key - the String keyword which maps to the double.
      val - the Double to put.
    • removeDouble

      public void removeDouble(String key)
      Removes a double from the doubleList.
      Parameters:
      key - the String keyword which maps to the double.
    • getDouble

      public Double getDouble(String key)
      Gets a double from the doubleList.
      Parameters:
      key - the String keyword which maps to the double.
      Returns:
      the Double in the list or null if not present.
    • putBoolean

      public void putBoolean(String key, Boolean val)
      Puts a boolean in the booleanList.
      Parameters:
      key - the String keyword which maps to the boolean.
      val - the Boolean to put.
    • removeBoolean

      public void removeBoolean(String key)
      Removes a boolean from the booleanList.
      Parameters:
      key - the String keyword which maps to the boolean.
    • getBoolean

      public Boolean getBoolean(String key)
      Gets a boolean from the booleanList.
      Parameters:
      key - the String keyword which maps to the boolean.
      Returns:
      the Boolean in the list or null if not present.
    • putEnum

      public void putEnum(String key, Enum<?> val)
      Puts an enum in the enumList.
      Parameters:
      key - the String keyword which maps to the enum.
      val - the Enum to put.
    • removeEnum

      public void removeEnum(String key)
      Removes an enum from the enumList.
      Parameters:
      key - the String keyword which maps to the enum.
    • getEnum

      public Enum<?> getEnum(String key)
      Gets an enum from the enumList.
      Parameters:
      key - the String keyword which maps to the enum.
      Returns:
      the Enum in the list or null if not present.
    • putObject

      public void putObject(String key, Object val)
      Puts an object in the enumList.
      Parameters:
      key - the String keyword which maps to the object.
      val - the Object to put.
    • removeObject

      public void removeObject(String key)
      Removes an object from the enumList.
      Parameters:
      key - the String keyword which maps to the object.
    • getObject

      public Object getObject(String key)
      Gets an object from the enumList.
      Parameters:
      key - the String keyword which maps to the object.
      Returns:
      the Object in the list or null if not present.
    • toString

      public String toString()
      Overrides:
      toString in class Object